home *** CD-ROM | disk | FTP | other *** search
- /* Scandir.rexx
- * Support script for pictures.fdb
- * Copyright © 1995-1997 Nils Bandener
- * $VER: scandir_frx 6.3 (6.10.97)
- */
-
- Options Results
-
- scriptname = "ScanDir"
-
- fiasco_port = address()
-
- Signal on Syntax
- Signal on Halt
- Signal on Break_C
- Signal on Failure
-
- LockGUI
-
- /*
- * Get the directory to search in
- */
-
- RequestFile Drawersonly ProjectRelative
-
- if rc = 0 then do
-
- /*
- * User did not cancel the requester
- */
-
- directory = Result
-
- RequestChoice '"Please select directory scan mode:*n1 - Selected only*n2 - Scan subdirectories*n3 - Scan subdirectories and lha archives" "1|2|3"'
- Mode = Result
-
- /*
- * Create a list
- */
-
- say "Scanning directory..."
-
- if mode = 2 | mode = 3 then
- do
- moreargs = "all"
- end
- else
- do
- moreargs = ""
- end
-
- Address Command 'list >t:fpdb_files "' || directory || '" lformat %s%s files pat ~(#?.info) ' || moreargs
-
- if rc = 0 then
- do
-
- Address Command "sort t:fpdb_files t:fpdbs_files"
-
- /* Address FIASCO */
-
- say "Adding pictures... (Press Ctrl-C for break)"
-
- if Open("g", "t:fpdbs_files", "read") then do
-
- do while ~eof("g")
- file = ReadLn("g")
-
- if file ~= "" then
- do
- if right(file, 4) = ".lha" then
- do
- Address Command 'lha >t:fpdb_lha_files vq "' || file || '"'
-
- if rc == 0 then
- do
- if Open("arc", "t:fpdb_lha_files", "read") then
- do
- dummy = readln("arc")
- dummy = readln("arc")
- dummy = readln("arc")
-
- do while ~eof("arc")
-
- arcfile = readln("arc")
-
- if arcfile ~= "" then
- do
- say "Adding picture " || arcfile || " in archive " || file || "..."
-
- call addpicture.frx(file || '/__in_archive__/' || arcfile)
-
- end
- end
-
- call Close("arc")
- end
- end
- end
- else
- do
- say "Adding picture " || file || "..."
-
- call addpicture.frx(file)
- end
- end
- end
-
- call Close("g")
- end
- end
- end
-
- bail_out:
-
- Address Value fiasco_port
-
- UnlockGUI
- ResetStatus
-
- exit
-
- syntax:
- failure:
-
- if show("Ports", fiasco_port) then
- do
- Address Value fiasco_port
-
- RequestChoice '"Error ' || rc || ' in line ' || sigl || ':*n' || errortext(rc) || '" "Cancel" Title "' || scriptname || '"'
- end
- else
- do
- say "Error" rc "in line" sigl ":" errortext(rc)
- say "Enter to continue"
- pull dummy
- end
-
- call bail_out
-
- halt:
- break_c:
-
- if show("Ports", fiasco_port) then
- do
- Address Value fiasco_port
-
- RequestChoice '"Script Abort Requested" "Abort Script" Title "' || scriptname || '"'
-
- if result = 0 then return
- end
- else
- do
- say "*** Break"
- say "Enter to continue"
- pull dummy
- end
-
- call bail_out
-
-